<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSystemCodeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_code', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type',64)->comment('类型');
            $table->string('type_name',64)->comment('类型名称');
            $table->string('value',64)->comment('值');
            $table->string('value_name',64)->comment('值名称');
            $table->integer('sort_no')->default(1)->commwnt('排序');
            $table->tinyInteger('is_default')->default(0)->comment('是否默认0:否 1:是');
            $table->tinyInteger('is_active')->default(1)->comment('是否有效0:否 1:是');
            $table->string('created_user',64)->default('')->comment('创建人');
            $table->string('updated_user',64)->default('')->comment('修改人');
            $table->timestamps();

            $table->unique(['type','value'],'uniq_type_value')->comment('基础唯一索引');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('system_code');
    }
}
